$input a_position, a_normal
$output v_fragPos, v_normal, v_lightPos, v_shadowCoord

#include "../../ShaderUtils/common.sh"

uniform mat4 u_lightMtx;
uniform vec4 u_lightPos;

void main()
{
	gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0));

	vec4 normal = a_normal * 2.0 - 1.0;
	v_normal = normalize(mul(u_modelView, vec4(normal.xyz, 0.0)).xyz);
	v_fragPos = mul(u_modelView, vec4(a_position, 1.0)).xyz;

	v_lightPos = normalize((u_view * u_lightPos).xyz);

	v_shadowCoord = mul(u_lightMtx, vec4(a_position, 1.0));
}